package com.free.md5parser.config;

import org.rocksdb.Options;
import org.rocksdb.RocksDB;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RocksDBConfig {

    @Value("${temp.dir:/data}")
    private String tempDir;

    static {
        RocksDB.loadLibrary();
    }

    @Bean
    public RocksDB rocksDB() throws Exception {
        Options options = new Options();
        options.setCreateIfMissing(true);
        return RocksDB.open(tempDir + "/rocksdb");
    }
}
